#!/usr/bin/env python

# !-*-coding:utf-8 -*-

# !@Time     : 2021/11/9 17:06

# !@Author   : xul

# !@File     : catTest.py


## START CODE HERE ##
import numpy as np
import scipy
from matplotlib import pyplot as plt
from scipy import ndimage

from Course_fourth.test import predict, parameters, classes
from Course_frist.test import num_px

my_image = "my_image.jpg"  # change this to the name of your image file
my_label_y = [1]  # the true class of your image (1 -> cat, 0 -> non-cat)
## END CODE HERE ##

fname = "images/" + my_image
image = np.array(ndimage.imread(fname, flatten=False))
my_image = scipy.misc.imresize(image, size=(num_px, num_px)).reshape((num_px * num_px * 3, 1))
my_predicted_image = predict(my_image, my_label_y, parameters)

plt.imshow(image)
print("y = " + str(np.squeeze(my_predicted_image)) + ", your L-layer model predicts a \"" + classes[
    int(np.squeeze(my_predicted_image)),].decode("utf-8") + "\" picture.")
